/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EscolherHorario.java
 *
 * Created on 27/11/2011, 15:56:24
 */

package view;

import java.sql.Timestamp;
import java.util.ArrayList;
import javax.swing.ButtonGroup;
import util.Observador;

/**
 *
 * @author tais
 */
public class EscolherHorario extends javax.swing.JFrame {
    private ButtonGroup group = new ButtonGroup();
    private ArrayList<Observador> observers = new ArrayList<Observador>();
    private ArrayList<String> proibidos = null;
    private String dia = null;;
    private String[] status = {"Livre", "Livre", "Livre", "Livre"
            , "Livre", " ", "Livre", "Livre", "Livre", "Livre"
            , "Livre", " ", "Livre", "Livre", "Livre", "Livre"};
    private boolean[] enable = {true, true, true, true
            , true, false, true, true, true,true
            , true, false, true, true, true, true};
    private int horarioSelecionado = 0;

    /** Creates new form EscolherHorario */
    public EscolherHorario(String dia, ArrayList<String> horariosProibidos,
            String nome, String crm) {
        initComponents();
        if(horariosProibidos == null){
            proibidos = new ArrayList<String>();
        }
        else{
            proibidos = horariosProibidos;
        }
        crmMedico.setText(crm);
        nomeMedico.setText(nome);
        this.dia = dia;
        this.setTitle("Agenda de "+dia.substring(8, 10)+"/"+dia.substring(5, 7)
                +"/"+dia.substring(0, 4));

        initExtraComponents();
        inicializarAgenda();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        status_7 = new javax.swing.JLabel();
        status_22 = new javax.swing.JLabel();
        status_21 = new javax.swing.JLabel();
        status_20 = new javax.swing.JLabel();
        status_19 = new javax.swing.JLabel();
        status_18 = new javax.swing.JLabel();
        status_17 = new javax.swing.JLabel();
        status_16 = new javax.swing.JLabel();
        status_15 = new javax.swing.JLabel();
        status_14 = new javax.swing.JLabel();
        status_13 = new javax.swing.JLabel();
        status_12 = new javax.swing.JLabel();
        status_8 = new javax.swing.JLabel();
        status_9 = new javax.swing.JLabel();
        status_10 = new javax.swing.JLabel();
        status_11 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        jrb_7 = new javax.swing.JRadioButton();
        jrb_8 = new javax.swing.JRadioButton();
        jrb_9 = new javax.swing.JRadioButton();
        jrb_10 = new javax.swing.JRadioButton();
        jrb_11 = new javax.swing.JRadioButton();
        jrb_12 = new javax.swing.JRadioButton();
        jrb_13 = new javax.swing.JRadioButton();
        jrb_14 = new javax.swing.JRadioButton();
        jrb_15 = new javax.swing.JRadioButton();
        jrb_16 = new javax.swing.JRadioButton();
        jrb_17 = new javax.swing.JRadioButton();
        jrb_18 = new javax.swing.JRadioButton();
        jrb_19 = new javax.swing.JRadioButton();
        jrb_20 = new javax.swing.JRadioButton();
        jrb_21 = new javax.swing.JRadioButton();
        jrb_22 = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();
        nomeMedico = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        crmMedico = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Agenda de dd/mm/yyyy");

        jPanel2.setBackground(new java.awt.Color(248, 246, 242));

        jLabel3.setFont(new java.awt.Font("Arial Black", 0, 14));
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("Horário");
        jLabel3.setName("0"); // NOI18N

        jLabel4.setFont(new java.awt.Font("Arial Black", 0, 14));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("Status");
        jLabel4.setName("0"); // NOI18N

        jLabel5.setFont(new java.awt.Font("Arial Black", 0, 14));
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText("Selecionar");
        jLabel5.setName("0"); // NOI18N

        jLabel6.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText("7:00:00");
        jLabel6.setName("7"); // NOI18N

        jLabel7.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel7.setText("8:00:00");
        jLabel7.setName("8"); // NOI18N

        jLabel8.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel8.setText("9:00:00");
        jLabel8.setName("9"); // NOI18N

        jLabel9.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel9.setText("10:00:00");
        jLabel9.setName("10"); // NOI18N

        jLabel10.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel10.setText("11:00:00");
        jLabel10.setName("11"); // NOI18N

        jLabel11.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel11.setText("12:00:00");
        jLabel11.setName("12"); // NOI18N

        jLabel12.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel12.setText("13:00:00");
        jLabel12.setName("13"); // NOI18N

        jLabel13.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel13.setText("14:00:00");
        jLabel13.setName("14"); // NOI18N

        jLabel14.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel14.setText("15:00:00");
        jLabel14.setName("15"); // NOI18N

        jLabel15.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel15.setText("16:00:00");
        jLabel15.setName("16"); // NOI18N

        jLabel16.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel16.setText("17:00:00");
        jLabel16.setName("17"); // NOI18N

        jLabel17.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel17.setText("18:00:00");
        jLabel17.setName("18"); // NOI18N

        jLabel18.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel18.setText("19:00:00");
        jLabel18.setName("19"); // NOI18N

        jLabel19.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel19.setText("20:00:00");
        jLabel19.setName("20"); // NOI18N

        jLabel20.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel20.setText("21:00:00");
        jLabel20.setName("21"); // NOI18N

        jLabel21.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel21.setText("22:00:00");
        jLabel21.setName("22"); // NOI18N

        status_7.setFont(new java.awt.Font("Arial", 0, 14));
        status_7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_7.setText("livre");
        status_7.setName("7"); // NOI18N

        status_22.setFont(new java.awt.Font("Arial", 0, 14));
        status_22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_22.setText("livre");
        status_22.setName("22"); // NOI18N

        status_21.setFont(new java.awt.Font("Arial", 0, 14));
        status_21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_21.setText("livre");
        status_21.setName("21"); // NOI18N

        status_20.setFont(new java.awt.Font("Arial", 0, 14));
        status_20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_20.setText("livre");
        status_20.setName("20"); // NOI18N

        status_19.setFont(new java.awt.Font("Arial", 0, 14));
        status_19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_19.setText("livre");
        status_19.setName("19"); // NOI18N

        status_18.setFont(new java.awt.Font("Arial", 0, 14));
        status_18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_18.setText("livre");
        status_18.setName("18"); // NOI18N

        status_17.setFont(new java.awt.Font("Arial", 0, 14));
        status_17.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_17.setText("livre");
        status_17.setName("17"); // NOI18N

        status_16.setFont(new java.awt.Font("Arial", 0, 14));
        status_16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_16.setText("livre");
        status_16.setName("16"); // NOI18N

        status_15.setFont(new java.awt.Font("Arial", 0, 14));
        status_15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_15.setText("livre");
        status_15.setName("15"); // NOI18N

        status_14.setFont(new java.awt.Font("Arial", 0, 14));
        status_14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_14.setText("livre");
        status_14.setName("14"); // NOI18N

        status_13.setFont(new java.awt.Font("Arial", 0, 14));
        status_13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_13.setText("livre");
        status_13.setName("13"); // NOI18N

        status_12.setFont(new java.awt.Font("Arial", 0, 14));
        status_12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_12.setText("livre");
        status_12.setName("12"); // NOI18N

        status_8.setFont(new java.awt.Font("Arial", 0, 14));
        status_8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_8.setText("livre");
        status_8.setName("8"); // NOI18N

        status_9.setFont(new java.awt.Font("Arial", 0, 14));
        status_9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_9.setText("livre");
        status_9.setName("9"); // NOI18N

        status_10.setFont(new java.awt.Font("Arial", 0, 14));
        status_10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_10.setText("livre");
        status_10.setName("10"); // NOI18N

        status_11.setFont(new java.awt.Font("Arial", 0, 14));
        status_11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        status_11.setText("livre");
        status_11.setName("11"); // NOI18N

        jLabel38.setFont(new java.awt.Font("Arial", 0, 14));
        jLabel38.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        jrb_7.setName("7"); // NOI18N
        jrb_7.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_7MouseClicked(evt);
            }
        });

        jrb_8.setName("8"); // NOI18N
        jrb_8.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_8MouseClicked(evt);
            }
        });

        jrb_9.setName("9"); // NOI18N
        jrb_9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_9MouseClicked(evt);
            }
        });

        jrb_10.setName("10"); // NOI18N
        jrb_10.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_10MouseClicked(evt);
            }
        });

        jrb_11.setName("11"); // NOI18N
        jrb_11.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_11MouseClicked(evt);
            }
        });

        jrb_12.setName("12"); // NOI18N
        jrb_12.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_12MouseClicked(evt);
            }
        });

        jrb_13.setName("13"); // NOI18N
        jrb_13.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_13MouseClicked(evt);
            }
        });

        jrb_14.setName("14"); // NOI18N
        jrb_14.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_14MouseClicked(evt);
            }
        });

        jrb_15.setName("15"); // NOI18N
        jrb_15.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_15MouseClicked(evt);
            }
        });

        jrb_16.setName("16"); // NOI18N
        jrb_16.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_16MouseClicked(evt);
            }
        });

        jrb_17.setName("17"); // NOI18N
        jrb_17.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_17MouseClicked(evt);
            }
        });

        jrb_18.setName("18"); // NOI18N
        jrb_18.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_18MouseClicked(evt);
            }
        });

        jrb_19.setName("19"); // NOI18N
        jrb_19.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_19MouseClicked(evt);
            }
        });

        jrb_20.setName("20"); // NOI18N
        jrb_20.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_20MouseClicked(evt);
            }
        });

        jrb_21.setName("21"); // NOI18N
        jrb_21.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_21MouseClicked(evt);
            }
        });

        jrb_22.setName("22"); // NOI18N
        jrb_22.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jrb_22MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_22, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_21, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_20, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_19, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_18, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_17, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_16, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_15, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_14, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_13, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_12, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_9, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_10, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(status_11, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(119, 119, 119)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(status_8, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(status_7, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(117, 117, 117)
                                .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_7))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_8))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_9))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_10))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_11))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_12))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_13))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_14))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_15))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_16))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_17))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_18))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_19))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_20))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_21))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(49, 49, 49)
                                .addComponent(jrb_22)))))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(status_8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel20)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel21))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(status_7)
                                .addGap(29, 29, 29)
                                .addComponent(status_9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_16)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_17)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_18)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_19)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_20)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_21)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(status_22))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jrb_7, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_8, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_9, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_10, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_11, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_12, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_13, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_14, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_15, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_16, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_17, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_18, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_19, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_20, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_21, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_22, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel1.setFont(new java.awt.Font("DejaVu Sans", 1, 12));
        jLabel1.setText("Dr. ");

        nomeMedico.setFont(new java.awt.Font("DejaVu Sans", 1, 12));
        nomeMedico.setText("Nome médico");

        jLabel2.setFont(new java.awt.Font("DejaVu Sans", 1, 12));
        jLabel2.setText("CRM ");

        crmMedico.setFont(new java.awt.Font("DejaVu Sans", 1, 12));
        crmMedico.setText("CRM médico");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 503, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(nomeMedico, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel2)
                        .addGap(18, 18, 18)
                        .addComponent(crmMedico, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(crmMedico)
                    .addComponent(jLabel2)
                    .addComponent(nomeMedico)
                    .addComponent(jLabel1))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jrb_7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_7MouseClicked
       if(jrb_7.isEnabled()){
           this.hourSelected(Integer.parseInt(jrb_7.getName()));
       }
    }//GEN-LAST:event_jrb_7MouseClicked

    private void jrb_8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_8MouseClicked
        if(jrb_8.isEnabled()){
            this.hourSelected(Integer.parseInt(jrb_8.getName()));
        }
    }//GEN-LAST:event_jrb_8MouseClicked

    private void jrb_9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_9MouseClicked
         if(jrb_9.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_9.getName()));
         }
    }//GEN-LAST:event_jrb_9MouseClicked

    private void jrb_10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_10MouseClicked
         if(jrb_10.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_10.getName()));
         }
    }//GEN-LAST:event_jrb_10MouseClicked

    private void jrb_11MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_11MouseClicked
         if(jrb_11.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_11.getName()));
         }
    }//GEN-LAST:event_jrb_11MouseClicked

    private void jrb_12MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_12MouseClicked
         if(jrb_12.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_12.getName()));
         }
    }//GEN-LAST:event_jrb_12MouseClicked

    private void jrb_13MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_13MouseClicked
         if(jrb_13.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_13.getName()));
         }
    }//GEN-LAST:event_jrb_13MouseClicked

    private void jrb_14MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_14MouseClicked
         if(jrb_14.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_14.getName()));
         }
    }//GEN-LAST:event_jrb_14MouseClicked

    private void jrb_15MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_15MouseClicked
         if(jrb_15.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_15.getName()));
         }
    }//GEN-LAST:event_jrb_15MouseClicked

    private void jrb_16MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_16MouseClicked
         if(jrb_16.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_16.getName()));
         }
    }//GEN-LAST:event_jrb_16MouseClicked

    private void jrb_17MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_17MouseClicked
         if(jrb_17.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_17.getName()));
         }
    }//GEN-LAST:event_jrb_17MouseClicked

    private void jrb_18MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_18MouseClicked
         if(jrb_18.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_18.getName()));
         }
    }//GEN-LAST:event_jrb_18MouseClicked

    private void jrb_19MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_19MouseClicked
         if(jrb_19.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_19.getName()));
         }
    }//GEN-LAST:event_jrb_19MouseClicked

    private void jrb_20MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_20MouseClicked
         if(jrb_20.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_20.getName()));
         }
    }//GEN-LAST:event_jrb_20MouseClicked

    private void jrb_21MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_21MouseClicked
         if(jrb_21.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_21.getName()));
         }
    }//GEN-LAST:event_jrb_21MouseClicked

    private void jrb_22MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jrb_22MouseClicked
         if(jrb_22.isEnabled()){
             this.hourSelected(Integer.parseInt(jrb_22.getName()));
         }
    }//GEN-LAST:event_jrb_22MouseClicked

    /**
    * @param args the command line arguments
    */
    /*
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new EscolherHorario().setVisible(true);
            }
        });
    }*/

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel crmMedico;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JRadioButton jrb_10;
    private javax.swing.JRadioButton jrb_11;
    private javax.swing.JRadioButton jrb_12;
    private javax.swing.JRadioButton jrb_13;
    private javax.swing.JRadioButton jrb_14;
    private javax.swing.JRadioButton jrb_15;
    private javax.swing.JRadioButton jrb_16;
    private javax.swing.JRadioButton jrb_17;
    private javax.swing.JRadioButton jrb_18;
    private javax.swing.JRadioButton jrb_19;
    private javax.swing.JRadioButton jrb_20;
    private javax.swing.JRadioButton jrb_21;
    private javax.swing.JRadioButton jrb_22;
    private javax.swing.JRadioButton jrb_7;
    private javax.swing.JRadioButton jrb_8;
    private javax.swing.JRadioButton jrb_9;
    private javax.swing.JLabel nomeMedico;
    private javax.swing.JLabel status_10;
    private javax.swing.JLabel status_11;
    private javax.swing.JLabel status_12;
    private javax.swing.JLabel status_13;
    private javax.swing.JLabel status_14;
    private javax.swing.JLabel status_15;
    private javax.swing.JLabel status_16;
    private javax.swing.JLabel status_17;
    private javax.swing.JLabel status_18;
    private javax.swing.JLabel status_19;
    private javax.swing.JLabel status_20;
    private javax.swing.JLabel status_21;
    private javax.swing.JLabel status_22;
    private javax.swing.JLabel status_7;
    private javax.swing.JLabel status_8;
    private javax.swing.JLabel status_9;
    // End of variables declaration//GEN-END:variables

    private void inicializarAgenda() {
        int i, idx;
        for(i=0;i<proibidos.size(); i++){
            idx = Integer.parseInt(proibidos.get(i).substring(0, 2));
            System.out.println(idx+"");
            if(idx > 6 && idx < 23){
                status[idx-7] = "Consulta agendada";
                enable[idx-7] = false;
            }
        }
       String nome = null;
       for(i=0;i<jPanel2.getComponentCount(); i++){
           if(jPanel2.getComponent(i) instanceof javax.swing.JLabel){
               javax.swing.JLabel l = (javax.swing.JLabel) jPanel2.getComponent(i);
               nome = l.getName();
           }
           else{
               if(jPanel2.getComponent(i) instanceof javax.swing.JRadioButton){
                   javax.swing.JRadioButton rb = (javax.swing.JRadioButton) jPanel2.getComponent(i);
                   nome = rb.getName();
               }
               else{
                   nome = null;
               }
           }
           if(nome == null){
               idx = 0;
           }
           else{
               idx = Integer.parseInt(nome);
           }

           if(idx > 6){
               jPanel2.getComponent(i).setEnabled(enable[idx-7]);
           }           
       }
       atualizaStatus();
    }

    public void hourSelected(int hour){
        horarioSelecionado = hour;
        this.notificar();
    }

    public String getHorarioSelecionado(){
        return Timestamp.valueOf(dia+" "+horarioSelecionado+":00:00")
                .toString().substring(11, 20);
    }

    private void initExtraComponents() {
        group.add(jrb_7);
	group.add(jrb_8);
        group.add(jrb_9);
        group.add(jrb_10);
        group.add(jrb_11);
	group.add(jrb_12);
        group.add(jrb_13);
        group.add(jrb_14);
        group.add(jrb_15);
	group.add(jrb_16);
        group.add(jrb_17);
        group.add(jrb_18);
        group.add(jrb_19);
	group.add(jrb_20);
        group.add(jrb_21);
        group.add(jrb_22);
    }

    private void atualizaStatus() {
        status_7.setText(status[0]);
        status_8.setText(status[1]);
        status_9.setText(status[2]);
        status_10.setText(status[3]);
        status_11.setText(status[4]);
        status_12.setText(status[5]);
        status_13.setText(status[6]);
        status_14.setText(status[7]);
        status_15.setText(status[8]);
        status_16.setText(status[9]);
        status_17.setText(status[10]);
        status_18.setText(status[11]);
        status_19.setText(status[12]);
        status_20.setText(status[13]);
        status_21.setText(status[14]);
        status_22.setText(status[15]);
    }

    public void notificar(){
        int i;
        for(i=0; i<observers.size(); i++){
            observers.get(i).atualizar(this);
        }
    }

    public void addObservador(Observador o){
        observers.add(o);
    }

}
